package com.unibeta.cloudtest.mesher.config;

import org.springframework.context.annotation.Bean;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@org.springframework.context.annotation.Configuration
@EnableSwagger2 
public class SwaggerConfig {
	@Bean 
	public Docket api() { 
	 return new Docket(DocumentationType.SWAGGER_2) 
	            .apiInfo(apiInfo()) 
	            .select() 
	            .apis(RequestHandlerSelectors.basePackage("com.unibeta.cloudtest")) 
	            .paths(PathSelectors.any()) 
	            .build(); 
	}
	
	private ApiInfo apiInfo() { 
		 return new ApiInfoBuilder() 
		            .title("CloudTest Mesh Service") 
		            .description("API specification for CloudTest Mesh Service") 
		            .termsOfServiceUrl("http://www.unibeta.org.cn/") 
		            .version("0.0.1") 
		            .contact(new Contact("com.unibeta.cloudtest", "http://www.unibeta.org.cn/", "jimy_xue@163.com")) 
		            .build(); 
		}
}
